Skip to content

[stable/3.94.0] Skip manifest generation when bundle dir matches local output#7418

Merged
isaacroldan merged 5 commits intostable/3.94.0from
04-28-stable_3.94.0_skip_manifest_generation_when_bundle_dir_matches_local_output
Apr 28, 2026
Merged

[stable/3.94.0] Skip manifest generation when bundle dir matches local output#7418
isaacroldan merged 5 commits intostable/3.94.0from
04-28-stable_3.94.0_skip_manifest_generation_when_bundle_dir_matches_local_output

Conversation

@isaacroldan
Copy link
Copy Markdown
Contributor

Backport of #7413 to stable/3.94.0. Also pulls in the prerequisite path-normalization fix (#7408 / commits e94c94eb50, 35deef9b9f) that #7413 depends on, since that fix never landed on stable. Without it the '/test/./extension/dist/handle.js' test from #7413 cannot pass.

WHY are these changes introduced?

When the local output directory and the bundle output directory resolve to the same path, there is no need to copy files or generate an assets manifest. Previously, the early return only skipped the file copy but still allowed manifest generation to proceed. Additionally, the same-path guard compared raw strings, so non-canonical shapes (a . segment, trailing slash, etc.) slipped through and fs-extra rejected the copy with "Source and destination must not be the same".

WHAT is this pull request doing?

Three cherry-picks from main:

  1. 7d8423aded — Normalize localOutputDir and bundleOutputDir via resolvePath before comparing them, so any string variant that maps to the same directory is caught.
  2. d6770b9dd7 — Regression test for the non-canonical path case (/test/extension/dist vs /test/./extension/dist).
  3. cb3bf67852 — When the resolved paths are equal, return early before both the file copy and any manifest generation. Adds a test verifying that neither copyFile nor createOrUpdateManifestFile is called when the two paths resolve to the same location.

Two changesets are included: one carried in from #7408's source commit, one new (skip-manifest-when-bundle-dir-matches-local.md) for the manifest-skip fix since #7413 didn't have one.

How to test your changes?

pnpm test packages/app/src/cli/services/build/steps/bundle-ui-step.test.ts

All three tests pass.

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch) and added a changeset with pnpm changeset add

🤖 Generated with Claude Code

vctrchu and others added 4 commits April 28, 2026 14:46
The same-path guard at bundle-ui-step.ts compared `localOutputDir` and
`bundleOutputDir` as raw strings. In practice these two values are
computed along different code paths (`dirname(buildUIExtension())` vs
`dirname(extension.outputPath)` or `joinPath(..., bundleFolder)`) and
can resolve to the same filesystem directory while differing as strings
— e.g. when one path has a `.` segment, a trailing slash, or otherwise
non-canonical shape. When that happens, the guard slips through and
fs-extra rejects the copy with "Source and destination must not be the
same".

Normalize both sides via `resolvePath` before comparing so the guard
catches any string variant that maps to the same directory.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Extends the same-path guard coverage with a case where localOutputDir
and bundleOutputDir are string-distinct but resolve to the same
directory (`/test/extension/dist` vs `/test/./extension/dist`). This
is the actual shape that triggered the original fs-extra "Source and
destination must not be the same" failure in the field — the existing
identical-strings test did not catch it because both the old and new
guard handle the trivial case.

Verified that this test fails against the pre-fix guard (`copyFile`
is called with distinct strings) and passes once the guard normalizes
both sides with `resolvePath`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The same-path guard previously only skipped the copy and still let manifest generation run. With the comment now explicitly stating both behaviors, lock that in with a test that verifies createOrUpdateManifestFile is not called when localOutputDir === bundleOutputDir, even with generatesAssetsManifest: true.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@isaacroldan isaacroldan requested review from a team as code owners April 28, 2026 12:47
@github-actions
Copy link
Copy Markdown
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/common/version.d.ts
@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "3.94.0";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "3.94.2";
\ No newline at end of file
packages/cli-kit/dist/public/node/cli-launcher.d.ts
@@ -1,8 +1,6 @@
-import type { LazyCommandLoader } from './custom-oclif-loader.js';
 interface Options {
     moduleURL: string;
     argv?: string[];
-    lazyCommandLoader?: LazyCommandLoader;
 }
 /**
  * Launches the CLI.
packages/cli-kit/dist/public/node/cli.d.ts
@@ -1,4 +1,3 @@
-import type { LazyCommandLoader } from './custom-oclif-loader.js';
 /**
  * IMPORTANT NOTE: Imports in this module are dynamic to ensure that "setupEnvironmentVariables" can dynamically
  * set the DEBUG environment variable before the 'debug' package sets up its configuration when modules
@@ -8,8 +7,6 @@ interface RunCLIOptions {
     /** The value of import.meta.url of the CLI executable module */
     moduleURL: string;
     development: boolean;
-    /** Optional lazy command loader for on-demand command loading */
-    lazyCommandLoader?: LazyCommandLoader;
 }
 /**
  * A function that abstracts away setting up the environment and running
@@ -20,7 +17,6 @@ export declare function runCLI(options: RunCLIOptions & {
     runInCreateMode?: boolean;
 }, launchCLI?: (options: {
     moduleURL: string;
-    lazyCommandLoader?: LazyCommandLoader;
 }) => Promise<void>, argv?: string[], env?: NodeJS.ProcessEnv, versions?: NodeJS.ProcessVersions): Promise<void>;
 /**
  * A function for create-x CLIs that automatically runs the "init" command.
@@ -42,5 +38,5 @@ export declare const jsonFlag: {
 /**
  * Clear the CLI cache, used to store some API responses and handle notifications status
  */
-export declare function clearCache(): Promise<void>;
+export declare function clearCache(): void;
 export {};
\ No newline at end of file
packages/cli-kit/dist/public/node/error.d.ts
@@ -1,6 +1,6 @@
+import { AlertCustomSection } from './ui.js';
 import { OutputMessage } from './output.js';
 import { InlineToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
-import type { AlertCustomSection } from './ui.js';
 export { ExtendableError } from 'ts-error';
 export declare enum FatalErrorType {
     Abort = 0,
packages/cli-kit/dist/public/node/is-global.d.ts
@@ -1,4 +1,4 @@
-import type { PackageManager } from './node-package-manager.js';
+import { PackageManager } from './node-package-manager.js';
 /**
  * Returns true if the current process is running in a global context.
  *
packages/cli-kit/dist/public/node/notifications-system.d.ts
@@ -24,7 +24,7 @@ declare const NotificationSchema: zod.ZodObject<{
     surface: zod.ZodOptional<zod.ZodString>;
 }, "strip", zod.ZodTypeAny, {
     id: string;
-    type: "info" | "error" | "warning";
+    type: "error" | "info" | "warning";
     message: string;
     frequency: "always" | "once" | "once_a_day" | "once_a_week";
     ownerChannel: string;
@@ -41,7 +41,7 @@ declare const NotificationSchema: zod.ZodObject<{
     surface?: string | undefined;
 }, {
     id: string;
-    type: "info" | "error" | "warning";
+    type: "error" | "info" | "warning";
     message: string;
     frequency: "always" | "once" | "once_a_day" | "once_a_week";
     ownerChannel: string;
@@ -84,7 +84,7 @@ declare const NotificationsSchema: zod.ZodObject<{
         surface: zod.ZodOptional<zod.ZodString>;
     }, "strip", zod.ZodTypeAny, {
         id: string;
-        type: "info" | "error" | "warning";
+        type: "error" | "info" | "warning";
         message: string;
         frequency: "always" | "once" | "once_a_day" | "once_a_week";
         ownerChannel: string;
@@ -101,7 +101,7 @@ declare const NotificationsSchema: zod.ZodObject<{
         surface?: string | undefined;
     }, {
         id: string;
-        type: "info" | "error" | "warning";
+        type: "error" | "info" | "warning";
         message: string;
         frequency: "always" | "once" | "once_a_day" | "once_a_week";
         ownerChannel: string;
@@ -120,7 +120,7 @@ declare const NotificationsSchema: zod.ZodObject<{
 }, "strip", zod.ZodTypeAny, {
     notifications: {
         id: string;
-        type: "info" | "error" | "warning";
+        type: "error" | "info" | "warning";
         message: string;
         frequency: "always" | "once" | "once_a_day" | "once_a_week";
         ownerChannel: string;
@@ -139,7 +139,7 @@ declare const NotificationsSchema: zod.ZodObject<{
 }, {
     notifications: {
         id: string;
-        type: "info" | "error" | "warning";
+        type: "error" | "info" | "warning";
         message: string;
         frequency: "always" | "once" | "once_a_day" | "once_a_week";
         ownerChannel: string;
packages/cli-kit/dist/public/node/hooks/postrun.d.ts
@@ -1,7 +1,3 @@
-/**
- * Postrun hook — uses dynamic imports to avoid loading heavy modules (base-command, analytics)
- * at module evaluation time. These are only needed after the command has already finished.
- */
 import { Hook } from '@oclif/core';
 /**
  * Check if post run hook has completed.
packages/cli-kit/dist/public/node/hooks/prerun.d.ts
@@ -14,4 +14,4 @@ export declare function parseCommandContent(cmdInfo: {
  * Triggers a background check for a newer CLI version (non-blocking).
  * The result is cached and consumed by the postrun hook for auto-upgrade.
  */
-export declare function checkForNewVersionInBackground(): Promise<void>;
\ No newline at end of file
+export declare function checkForNewVersionInBackground(): void;
\ No newline at end of file

@isaacroldan isaacroldan merged commit f3c4e7f into stable/3.94.0 Apr 28, 2026
24 checks passed
@isaacroldan isaacroldan deleted the 04-28-stable_3.94.0_skip_manifest_generation_when_bundle_dir_matches_local_output branch April 28, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants